import ajax from '@/utils/request'

// 用户不感兴趣的文章接口
export const dislike = articleID => {
  return ajax({
    method: 'POST',
    url: '/app/v1_0/article/dislikes',
    data: {
      target: articleID
    }
  })
}

// 举报文章接口
export const report = (articleID, typeID) => {
  return ajax({
    method: 'POST',
    url: '/app/v1_0/article/reports',
    data: {
      target: articleID,
      type: typeID
    }
  })
}

// 根据id获取文章详情
export const getArticle = id => {
  return ajax({
    method: 'GET',
    url: '/app/v1_0/articles/' + id
  })
}
/**
 * 取消点赞
 * @params{*} 文章id
 */
export const deleltLike = id => {
  return ajax({
    method: 'DELETE',
    url: '/app/v1_0/article/likings/' + id
  })
}
/**
 * 点赞
 * @params{*} 文章id
 */
export const addLike = id => {
  return ajax({
    method: 'POST',
    url: '/app/v1_0/article/likings',
    data: {
      target: id
    }
  })
}
// 取消不喜欢
export const deleltDisLike = id => {
  return ajax({
    method: 'DELETE',
    url: '/app/v1_0/article/dislikes/' + id
  })
}
// 添加不喜欢
export const addDisLike = id => {
  return ajax({
    method: 'POST',
    url: '/app/v1_0/article/dislikes',
    data: {
      target: id
    }
  })
}
